package com.ymx.darling.wrapper.fragment;

import com.ymx.darling.util.StringLink;
import com.ymx.darling.bean.sql.SqlStatement;

import java.util.ArrayList;

public class OrderBySegment implements SqlSegment {
    private final StringLink orderBy = new StringLink();

    @Override
    public SqlStatement getSqlStatement() {
        orderBy.deleteLast();

        return new SqlStatement(orderBy.toString(), new ArrayList<>());
    }

    public void orderByDes(String colum){
        orderBy.append(colum).append(" DESC").append(",");
    }

    public void orderByAsc(String colum){
        orderBy.append(colum).append(" ASC").append(",");
    }
}
